Practical Data Analysis by Unknown
Author:Unknown
Language: eng
Format: epub, pdf
Publisher: Packt Publishing
Solving ordinary differential equation for the SIR model with SciPy
In order to observe the morphology of an infectious disease outbreak, we need to solve the SIR model. In this case, we will use the integrate method of the SciPy module to solve the ODE. In Appendix, Setting Up the Infrastructure, we can find the installation instructions for SciPy.
First, we need to import the required libraries scipy and pylab.
import scipy import scipy.integrate import pylab as plt
Then, we will define the SIR_model function, which will contain the ODE, with beta representing the transmission probability, gamma as the infected period, X[0] representing the susceptible population, and X[1] representing the infected population:
beta = 0.003 gamma = 0.1 def SIR_model(X, t=0): r = scipy.array([- beta*X[0]*X[1] , beta*X[0]*X[1] - gamma*X[1] , gamma*X[1] ]) return r
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Brazilian Economy since the Great Financial Crisis of 20072008 by Philip Arestis Carolina Troncoso Baltar & Daniela Magalhães Prates(351521)
International Integration of the Brazilian Economy by Elias C. Grivoyannis(111540)
The Art of Coaching by Elena Aguilar(53585)
Flexible Working by Dale Gemma;(23349)
How to Stop Living Paycheck to Paycheck by Avery Breyer(19824)
Thinking, Fast and Slow by Kahneman Daniel(12500)
The Acquirer's Multiple: How the Billionaire Contrarians of Deep Value Beat the Market by Tobias Carlisle(12421)
The Radium Girls by Kate Moore(12159)
The Art of Thinking Clearly by Rolf Dobelli(10687)
Hit Refresh by Satya Nadella(9236)
The Compound Effect by Darren Hardy(9133)
Tools of Titans by Timothy Ferriss(8567)
Atomic Habits: Tiny Changes, Remarkable Results by James Clear(8487)
Turbulence by E. J. Noyes(8180)
A Court of Wings and Ruin by Sarah J. Maas(8081)
Change Your Questions, Change Your Life by Marilee Adams(7912)
Nudge - Improving Decisions about Health, Wealth, and Happiness by Thaler Sunstein(7833)
How to Be a Bawse: A Guide to Conquering Life by Lilly Singh(7596)
Win Bigly by Scott Adams(7318)